// To parse this JSON data, do
//
//     final news = newsFromJson(jsonString);

import 'dart:convert';

class News {
  News({
    this.code,
    this.msg,
    this.newslist,
  });

  int code;
  String msg;
  List<Newslist> newslist;

  factory News.fromRawJson(String str) => News.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory News.fromJson(Map<String, dynamic> json) => News(
    code: json["code"] == null ? null : json["code"],
    msg: json["msg"] == null ? null : json["msg"],
    newslist: json["newslist"] == null ? null : List<Newslist>.from(json["newslist"].map((x) => Newslist.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "code": code == null ? null : code,
    "msg": msg == null ? null : msg,
    "newslist": newslist == null ? null : List<dynamic>.from(newslist.map((x) => x.toJson())),
  };
}

class Newslist {
  Newslist({
    this.ctime,
    this.title,
    this.description,
    this.picUrl,
    this.url,
    this.source,
  });

  DateTime ctime;
  String title;
  String description;
  String picUrl;
  String url;
  String source;

  factory Newslist.fromRawJson(String str) => Newslist.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Newslist.fromJson(Map<String, dynamic> json) => Newslist(
    ctime: json["ctime"] == null ? null : DateTime.parse(json["ctime"]),
    title: json["title"] == null ? null : json["title"],
    description: json["description"] == null ? null : json["description"],
    picUrl: json["picUrl"] == null ? null : json["picUrl"],
    url: json["url"] == null ? null : json["url"],
    source: json["source"] == null ? null : json["source"],
  );

  Map<String, dynamic> toJson() => {
    "ctime": ctime == null ? null : ctime.toIso8601String(),
    "title": title == null ? null : title,
    "description": description == null ? null : description,
    "picUrl": picUrl == null ? null : picUrl,
    "url": url == null ? null : url,
    "source": source == null ? null : source,
  };
}
